package com.wl.application.controller;

import com.wl.application.entity.Emp;
import com.wl.application.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author wl
 * @version 1.0
 * @date 2022/6/14
 * @description:
 */
@RestController
public class EmpController {

    @Autowired
    private EmpService empService;

    @GetMapping("/list")
    public List<Emp> list(){
        return empService.list();
    }
    @PostMapping("/addEmp")
    public String addEmp(@RequestBody Emp emp){
        return empService.addEmp(emp)+"";
    }


    @PutMapping("/updateEmp")
    public String updateEmp(@RequestBody Emp emp){
        return empService.updateEmp(emp)+"";
    }

    @DeleteMapping("/delEmp")
    public String delEmp(Integer eno){
        return String.valueOf(empService.delEmp(eno));
    }
}
